<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
   <link href="/static/css/adminlte.min.css" rel="stylesheet">

    <style>

        body {   }


  .hide{
  display:none;
  }
  .rt-bar{
        right: 0px;
        position:fixed;
        top:0px;
  }


.onhover{display:none}
:hover>.onhover{display:inline-block;}

  #container{padding-top:7px;}

  .container-lg,.container-md{
    max-width:1690px;
  }












    </style>
    <title> PM2024 </title>
    <th:block th:include="::header"></th:block>

</head>
<body class="hold-transition sidebar-collapse layout-top-nav">
<div class="wrapper">
    <!-- Preloader -->
    <ol class="breadcrumb">
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/" class="nav-link"> 首页 </a>

        </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/sys/user/list" class="nav-link"> 用户 </a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/pm/issue/list" class="nav-link"> 专题 </a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/pm/task/list" class="nav-link"> 任务 </a>
        </li><li class="nav-item d-none d-sm-inline-block">
        <a href="/pm/work/log/list" class="nav-link"> 工时 </a>
    </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/pm/task/log/list" class="nav-link"> 任务日志 </a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/pm/attachment/list" class="nav-link"> 附件 </a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/resource/file/list" class="nav-link"> 素材 </a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/sys/dict/catalog/list" class="nav-link"> 词典 </a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/pm/attendance/clock/list" class="nav-link">打卡</a>
        </li><li class="nav-item d-none d-sm-inline-block">
        <a href="/pm/work/day/list" class="nav-link">工作日</a>
    </li>
        <li class="nav-item d-none d-sm-inline-block">
            <a href="/login" class="nav-link">登录</a>
        </li>

    </ol>

    <div class="content-wrapper">
        <th:bolck th:insert="::content"></th:bolck>
    </div>

</div>


<script src="/static/vue/vue.global.js"></script>
<!--<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>-->
<script src="/static/js/axios.min.js"></script>
<script src="/static/js/jquery.min.js"></script>
<!--                   local                   -->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<!--<script src="https://fastly.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>-->


<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<!--<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>-->

<script src="/static/js/store.everything.min.js"></script>
<!--<script src="https://cdn.bootcdn.net/ajax/libs/timeago.js/4.0.2/timeago.full.min.js"></script>-->
<script src="/static/js/dayjs.min.js"></script>
<script type="text/javascript" src="/static/js/pxmu.min.js"></script>
<script>

var accessToken=null;
 var _QS = {}

 !function(){
      var qs = {}
      var x = (window.location.search || "?").substring(1).split("&");
    for(var i=0;i<x.length;i++){
        var ss = x[i].split("=");
        qs[ss[0]] = ss.length>1 ? ss[1] :'';
    }
    _QS = qs;
  }() ;



function _init(){



axios.interceptors.response.use(
  function (response) {
    if (response?.data?.error_code === 0) {
      return response
    }
    if(response?.data?.success) return response;
    console.log(response)
    if (response.data.code === 401) {
      showMsg("请重新的登录")
    }
    showMsg({msg:response?.data?.message || response.data.code})
    // 将未处理的异常往外抛
    // 注：如果没有return Promise.reject(response)，或者是直接return; 的话，当前请求的响应仍然会进行then中，只是它的response是undefined的。
    // 所以直接返回Promise.reject，在catch方法哪里就直接吃掉。
    return Promise.reject(response)
  },
  function (error) {
    // todo: 做一些其他日志记录处理
    showMsg({msg:error})
  }
)

if(!accessToken && store) accessToken = store.get("accessToken");
axios.interceptors.request.use(
  function (request) {
    if(!accessToken) accessToken = _QS['access_token'];
    console.log("access_token="+accessToken)
    if(accessToken) request.headers["access_token"] = accessToken;
    return  request
  },
  function (error) {
  }
)
}
<!--axios.interceptors.response.use(-->
<!--  function (response){-->
<!--    if(response.data.errorCode){-->
<!--        console.log("error",response.data);-->
<!--    }-->
<!--  }-->
<!-- )-->

function login(data){
    data.session=true;
    axios.post("/login",data).then(function (res) {
        console.log( res)
        store.set("accessToken",res?.data?.accessToken);
        store.set("loginedUser",res?.data?.user);
    }).catch(function (error) {
        console.log("error",error);
 }); }



function loginPath(cfg){
cfg=cfg ||{}
    var path=cfg.path ||  window.location.pathname;
    var data={username:path,type:'path',password:path}
    axios.post("/login",data).then(function (response) {
        //console.log( response)
         //console.log( response.data.accessToken)
         var url =  window.location.href;
         if(url.lastIndexOf("?")>0) url=url+"&access_token="+response.data.accessToken
         else url=url+"?access_token="+response.data.accessToken
         console.log(url)
         if(cfg.handler) cfg.handler(url,response.data.accessToken)
    }).catch(function (error) {
        console.log("error",error);
 });
 }
function cloneJSON(data){
    return JSON.parse(JSON.stringify(data));
}

function showMsg(msg){
    msg = msg || {}
    if(typeof msg == "string") msg = {msg:msg}
    pxmu.toast({
        msg: msg.msg || "提示消息",
        time: 2500, //停留时间 默认2500毫秒
        bg: 'rgba(0, 0, 0, 0.86)', //背景颜色 默认黑色
        color: '#fff', //文字颜色 默认白色
        location: '',//居中center 顶部top 底部bottom默认
        animation: 'slidedown', //显示的动画 默认fade 动画支持详见动画文档
        type: 'wap', //默认wap样式 可选参数：pc 入参pc时
        status: '', //可选参数 success成功 warn警告 error错误 仅在type=pc时候生效，wap时可通过自定义bg、color改变样式
    });
}


function httpPost(url,data,cfg){

    axios.post(url,data, cfg).then(function (response) {
        console.log( response);
        if(cfg && cfg.success) cfg.success(response)
    }).catch(function (error) {
        console.log("error",error);
    });
}
var loginedUser = null;
window.addEventListener("load",function(){
     _init();
    if(!accessToken && store){
        console.log("read token")
        accessToken = store.get("accessToken");
        if(!accessToken){
            //login({type:"username",username:"admin",password:"pwd20240313"})
        }
    }
    loginedUser = store.get("loginedUser");
})


</script>
<th:block th:insert="::footer"></th:block>
<script>

</script>


</body>
</html>